package org.gushi.datastruct.a05;

public class MainTest {


    public static void main(String[] args) {

//        Queue<Integer> queue = new ArrayQueue();
//        queue.offer(1);
//        queue.offer(2);
//        queue.offer(3);
//        queue.offer(4);
//        queue.offer(5);
//
//        System.out.println(queue.poll());
//        System.out.println(queue.poll());
//        System.out.println(queue.poll());
//        System.out.println(queue.poll());
//        System.out.println(queue.peek());
//        System.out.println(queue.poll());

//        Deque<Integer> deque = new Deque();
//        deque.enQueueRear(1);//队尾入队
//        deque.enQueueRear(2);
//        deque.enQueueRear(3);
//        deque.enQueueRear(4);
//
//        System.out.println(deque.deQueueFront());
//        System.out.println(deque.deQueueFront());
//        System.out.println(deque.deQueueFront());
//        System.out.println(deque.deQueueFront());

        CircleQueue<Integer> circleQueue = new CircleQueue<Integer>();
        circleQueue.offer(1);
        circleQueue.offer(2);
        circleQueue.offer(3);
        circleQueue.offer(4);
        circleQueue.offer(5);
        circleQueue.offer(6);
        circleQueue.offer(7);
        circleQueue.offer(8);
        circleQueue.offer(9);
        circleQueue.offer(10);
        circleQueue.offer(11);
        circleQueue.offer(12);
        circleQueue.offer(13);
        circleQueue.offer(14);
        circleQueue.offer(15);
        Object[] o = circleQueue.getElements();
        for (int i = 0;i<5;i++){
//            System.out.print(o);
            circleQueue.poll();
        }
        //front---5  6 7 8 9 10 11 12 13 14 15 5 6 7 8 9
        for (int i = 0;i<5;i++){
//            System.out.print(o);
            circleQueue.offer(i+5);
        }
        for (int i = 0;i<15;i++){
//            System.out.print(o);
            System.out.print(circleQueue.poll()+",");
        }

        System.out.println("----" + circleQueue.getFront());
        System.out.println(circleQueue.peek());

    }

}
